<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link href="thread.css" rel="stylesheet" type="text/css"/>
		
		
	</head>
	<body class="bbs">
		<header>
			<span onclick="showadd()">我要发帖</span>
				
		</header>
		<section>
			<div id="pic">
	    	<img name="tom" class="tom" src="img/tou01.jpg" />
			<img name="tom" class="tom" src="img/tou02.jpg" />
			<img name="tom" class="tom" src="img/tou03.jpg" />
			<img name="tom" class="tom" src="img/tou04.jpg" />
			<img src="" id="showhead"/>
	    </div>
	    <div id="mkthread">
	    	<span id="apply" onclick="addthread()" >发布</span>
	    	<input id="title" type="text" width="250px" value="请输入标题（1-50个字符" /><br />
	    所属版块：<select id="choose">
	    	 <option>新手报到</option>
	    	<option>新课来了</option>
	    	<option>老手经验</option>
	    	<option selected="selected">请选择版块</option>
	    	</select><br />
	    	<textarea id="content" rows="10" cols="80"></textarea>
	    	
	    </div>
	    <div id="show">
	    	<ul>
	    		<li>
	    			
	    		</li>
	    	</ul>

	    </div>
			
			
		</section>
	</body>
	<script type="text/javascript">
		function showadd(){
			
			var threadlist=document.getElementById("mkthread");
		    threadlist.style.display="block";
		}
		function addthread(){
		var title=document.getElementById("title").value;
		var forum=document.getElementById("choose").options[document.getElementById("choose").selectedIndex].value;
		var time=new Date();
		var content=document.getElementById("content").value;
		
		var show=document.getElementsByTagName("ul");
		var liele=document.createElement("li");
		var h1title=document.createElement("span");
		var imgpart=document.createElement("img");
		imgpart.src=showsign();
		imgpart.style.borderRadius="50%";
		h1title.style.fontWeight="bold";
		h1title.innerHTML=title+"   内容："+content;
		
		var ppart=document.createElement("p");
		ppart.innerHTML="\n版块："+forum+"       发表时间："+time;
		var join=imgpart+h1title;
		liele.appendChild(imgpart);liele.appendChild(h1title);liele.appendChild(ppart);
		show[0].appendChild(liele);
		imgpart.style.float="left";
        }
		
		function showsign(){
		var arr=[];
		var SS=document.getElementsByName("tom");
       
        var j=Math.floor(Math.random()*4);
     return SS[j].src;
	
		
		}
	</script>
	
</html>

